import request from "./request"

export default {
  /**
   * 请求城市数据
   * @returns 
   */
  queryCityJson: () => request.query({
    url: '/sjzsj-rights-api/city.json',
    method: 'GET',
    noToken: true,
  }),

  /**
   * 请求
   * @returns 
   */
  queryOrgList: () => request.query({
    url: '/sjzsj-rights-api/organizations/org-list',
    method: 'GET'
  }),

  /**
   * 手机号绑定
   * @param data 
   * @returns 
   */
  queryMiniBind: (data: { code: string, encryptedData: string, iv: string }) => request.query({
    url: '/sjzsj-rights-api/sjzsj/mini-bind',
    method: 'POST',
    data
  }),

  /**
   * 一键登陆
   * @param data 
   * @returns 
   */
  queryMiniLogin: (data: { wechat_code: string }) => request.query({
    url: '/sjzsj-rights-api/sjzsj/mini-bind',
    method: 'GET',
    data
  }),

  /**
   * 获取用户信息
   * @param data 
   * @returns 
   */
  queryUserInfo: () => request.query({
    url: '/sjzsj-rights-api/sjzsj/mini-bind',
    method: 'GET'
  }),

  /**
   * 查询任务信息
   */
  queryTasks: () => request.query({
    url: '/sjzsj/api/query',
    method: 'POST',
    data: {
      query: `query{
        tasks{
          task{
            id
            name
            createdDate
            processDefinitionId
            processInstanceId
            status
            taskDefinitionKey
            businessKey
          }
          Assessment{
            id
            assessmentNo
            succourType
            applyType
            createdAt
            userBasicInfo{
              id
              realName
              applyArea
              userCensusRegister{
                type
                censusRegisterProvince 
                censusRegisterCity 
                censusRegisterCounty 
                censusRegisterVillage 
                censusRegisterStreet 
                censusRegisterAddressDetail   
              }
            }
            publicity{
              assessmentId
              beginTime
              endTime
            }
          }
        }
      }`
    }
  })
}